﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL;

public partial class Reprb_Cydrb : System.Web.UI.Page
{
    string strApp = "";
    string repType = "日报";
    public static string repName = "";
    public string bmp = "";

    BLL.BLLRep br = new BLLRep();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["repName"].ToString() == "cyd")
        {
            repName = "厂用电报表";
            bmp = "cydrb.bmp";
        }
        else if (Request.QueryString["repName"].ToString() == "zh")
        {
            repName = "综合报表";
            bmp = "zhzbrcx.bmp";
        }
        else if (Request.QueryString["repName"].ToString() == "gl")
        {
            repName = "锅炉报表";
            bmp = "glzbrcx.bmp";
        }
        else if (Request.QueryString["repName"].ToString() == "qj")
        {
            repName = "汽机报表";
            bmp = "qjzbrcx.bmp";
        }
        if (!IsPostBack)
        {
            DateTime dt = System.DateTime.Now;

            this.qsrq.Value = dt.AddDays(-1).ToString("yyyy-MM-dd H:00:00");
            this.jsrq.Value = dt.AddDays(0).ToString("yyyy-MM-dd H:00:00");

            strApp = br.RetTableByDay(repName, repType, this.qsrq.Value, this.jsrq.Value);

            this.show.InnerHtml = strApp;
        }
    }

    protected void btnChaXun_Click(object sender, EventArgs e)
    {
        string qsrq = this.qsrq.Value;
        string jsrq = this.jsrq.Value;

        strApp = br.RetTableByDay(repName, repType, qsrq, jsrq);

        this.show.InnerHtml = strApp;
    }

    //上一天
    protected void btnPre_Click(object sender, EventArgs e)
    {
        //Response.Write("Pre");

        //DateTime dtInput = Convert.ToDateTime(this.Date1.Value).AddDays(-1);

        //this.Date1.Value = Convert.ToDateTime(this.Date1.Value).AddDays(-1).ToString("yyyy-MM-dd");

        //strApp = br.RetTableByDay(repName, repType, dtInput);

        //this.show.InnerHtml = strApp;
    }

    //下一天
    protected void btnNext_Click(object sender, EventArgs e)
    {
        ////Response.Write("Next");
        //DateTime dtInput = Convert.ToDateTime(this.Date1.Value).AddDays(+1);

        //this.Date1.Value = Convert.ToDateTime(this.Date1.Value).AddDays(+1).ToString("yyyy-MM-dd");

        //strApp = br.RetTableByDay(repName, repType, dtInput);

        //this.show.InnerHtml = strApp;
    }
}
